<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>gen_uuid (SM_util)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/sm_util.rb, line 19</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">SM_util</span>.<span class="ruby-identifier">gen_uuid</span>
    <span class="ruby-identifier">uuid_create</span> = <span class="ruby-constant">Win32API</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'rpcrt4'</span>, <span class="ruby-value str">'UuidCreate'</span>, <span class="ruby-value str">'P'</span>, <span class="ruby-value str">'L'</span>)
    <span class="ruby-identifier">result</span> = <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-value">16</span> <span class="ruby-comment cmt">#allocate a 16 string of blanks to hold the uuid</span>
    <span class="ruby-identifier">uuid_create</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">result</span>) <span class="ruby-comment cmt">#invoke the UuidCrete fx from Win32API</span>
    <span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span>,<span class="ruby-identifier">c</span>,<span class="ruby-identifier">d</span>,<span class="ruby-identifier">e</span>,<span class="ruby-identifier">f</span>,<span class="ruby-identifier">g</span>,<span class="ruby-identifier">h</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'SSSSSSSS'</span>)
    <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">'%04X%04X-%04X-%04X-%04X-%04X%04X%04X'</span>, <span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>, <span class="ruby-identifier">c</span>, <span class="ruby-identifier">d</span>, <span class="ruby-identifier">e</span>, <span class="ruby-identifier">f</span>, <span class="ruby-identifier">g</span>, <span class="ruby-identifier">h</span>)
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>
